﻿<%@ Page Title="" Language="C#" MasterPageFile="~/SiteUser.master" AutoEventWireup="true" CodeFile="ViewCIQuotes.aspx.cs" 
 EnableEventValidation="false" MaintainScrollPositionOnPostback="true" Inherits="carinsurance_ViewCIQuotes" %>

<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div class="provider_inner">
        <h1>
            Car Insurance</h1>
        <div class="right_action">
            <asp:HyperLink runat="server" Visible="false" ID="lnkNewCarUsage" NavigateUrl="#"
                Text="New"></asp:HyperLink>
        </div>
        <fieldset>
            <dl>
                <dt class="top_action">
                    <label>
                        Agent :
                    </label>
                </dt>
                <dd>
                    <asp:DropDownList ID="ddlCXAgents" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlCXAgents_SelectedIndexChanged">
                        <asp:ListItem Text="All" Value="0" />
                        <asp:ListItem Text="Kamal" Value="1" />
                        <asp:ListItem Text="Eza" Value="2" />
                        <asp:ListItem Text="Crystal" Value="3" />
                    </asp:DropDownList>
                  Quotes Date :
                    <asp:DropDownList ID="ddlQuoteDate" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlQuoteDate_SelectedIndexChanged">
                    </asp:DropDownList>
                    Search :
                    <asp:TextBox ID="txtSearch" Text="99999999" runat="server" Width="150px" ToolTip="Search by Name or Mobile No"
                        MaxLength="50" />
                    <asp:Button ID="ibtSubmit" runat="server" Text="Submit" OnClick="ibtSubmit_Click" />
                    <asp:HyperLink ID="hplViewScript" runat="server" Target="_blank">View CI Script</asp:HyperLink>&nbsp;
                </dd>
            </dl>
            <div style="display:none;">
                Company Name :
                    <asp:DropDownList ID="ddlProviderCompany" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlProviderCompany_SelectedIndexChanged">
                        <asp:ListItem Text="Liberty Insurance" Value="29" />
                        <asp:ListItem Text="Etiqa" Value="30" />
                    </asp:DropDownList>
            </div>
        </fieldset>
        <asp:GridView ID="grvCarInsurance" runat="server" AllowPaging="True" AutoGenerateColumns="False"
            CellPadding="2" EmptyDataText="There are no data records to display." CssClass="progridstyle"
            SelectedRowStyle-CssClass="progridodd" GridLines="None" OnSelectedIndexChanged="grvCarInsurance_SelectedIndexChanged"
            PagerStyle-CssClass="pgrpro" DataSourceID="sqlDsCarInsurance" DataKeyNames="RefCEUserId,CECarId, CECarPolicyId, Mobile"
            AllowSorting="True" OnPageIndexChanged="grvCarInsurance_PageIndexChanged">
            <Columns>
                <asp:BoundField DataField="RefCEUserId" Visible="false" HeaderText="RefCEUserId"
                    SortExpression="RefCEUserId" />
                <asp:BoundField DataField="CECarId" HeaderText="CarId" SortExpression="CECarId" />
                <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
                <asp:BoundField DataField="Mobile" HeaderText="Mobile" SortExpression="Mobile" />
                <asp:BoundField DataField="SurName" HeaderText="SurName" SortExpression="SurName" />
                <asp:BoundField DataField="FirstName" HeaderText="FirstName" SortExpression="FirstName" />
                <asp:BoundField DataField="MakeModelDesc" HeaderText="MakeModelDesc" SortExpression="MakeModelDesc" />
                <asp:BoundField DataField="CoverageCommenceDate" HeaderText="Commencement Date" DataFormatString="{0:dd/MMM/yyyy}"
                    SortExpression="CoverageCommenceDate" />
                <asp:BoundField DataField="ModifiedDate" DataFormatString="{0:dd/MMM/yyyy hh:mm:ss tt}"
                    HeaderText="Quote Date/Time" SortExpression="ModifiedDate" />
                <asp:CommandField ShowSelectButton="True" />
            </Columns>
            <FooterStyle />
            <PagerStyle />
            <SelectedRowStyle CssClass="progridover" />
            <HeaderStyle CssClass="progridheader" />
            <EditRowStyle />
            <AlternatingRowStyle CssClass="progridodd" />
            <RowStyle CssClass="progrideven" />
        </asp:GridView>
        <asp:SqlDataSource ID="sqlDsCarInsurance" runat="server" ConnectionString="<%$ ConnectionStrings:CX_CRMDBConnectionString %>"
            SelectCommand="sprocCXCarInsuranceSelectUserListByQuoteDate" SelectCommandType="StoredProcedure">
            <SelectParameters>
                <asp:ControlParameter ControlID="ddlQuoteDate" Name="QuoteDate" PropertyName="SelectedValue"
                    Type="String" />
                <asp:ControlParameter ControlID="txtSearch" Name="SearchKey" DefaultValue="%" PropertyName="Text"
                    Type="String" />
                <asp:ControlParameter ControlID="ddlCXAgents" Name="AgentId" PropertyName="SelectedValue"
                    Type="Int64" />
            </SelectParameters>
        </asp:SqlDataSource>
            
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
            <asp:HyperLink ID="hplDownLoad" Visible="false" runat="server" Target="_blank">DOWNLOAD QUOTE</asp:HyperLink>
            <asp:Button ID="btnDownload" runat="server" Visible="false" Text="DOWNLOAD QUOTE"
                OnClick="btnDownload_Click" />
            </ContentTemplate>
        </asp:UpdatePanel>
               
        <asp:UpdatePanel ID="upldivCustomerMoreDetail" runat="server">
            <ContentTemplate>
                <div runat="server" id="divCustomerMoreDetail" visible="false">
                    <asp:Label ID="Label3" runat="server" Text="More Details" Font-Size="Large" Font-Bold="true" />
                    <table cellpadding="2" cellspacing="2" width="100%" border="0">
                        <tr>
                            <td align="left" width="25%" height="25">License Pass Date: (dd/MM/yyyy)</td>
                            <td>
                                <asp:TextBox ID="txtLicensePassDate" runat="server" MaxLength="10"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="rfvLicensePassDate" ValidationGroup="moredetails" runat="server"
                                        ControlToValidate="txtLicensePassDate"   ErrorMessage="Required" />
                            </td>
                            <td align="left">Vehicle Number:</td>
                            <td>
                                <asp:TextBox ID="txtVehicleNumber" runat="server" MaxLength="12"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="rfvVehicleNumber" ValidationGroup="moredetails" runat="server"
                                        ControlToValidate="txtVehicleNumber"   ErrorMessage="Required" />
                            </td>
                        </tr>
                        <tr>
                            <td align="left" width="25%" height="25">Registration Date: (dd/MM/yyyy)</td>
                            <td>
                                <asp:TextBox ID="txtRegistrationDate" runat="server" MaxLength="10"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="rfvRegistrationDate" ValidationGroup="moredetails" runat="server"
                                        ControlToValidate="txtRegistrationDate"   ErrorMessage="Required" />
                            </td>
                            <td align="left">Type of Cover:</td>
                            <td>
                                <asp:DropDownList ID="ddlCoverType" runat="server"></asp:DropDownList>
                                <asp:RequiredFieldValidator ID="rfvCoverType" ValidationGroup="moredetails" runat="server"
                                        ControlToValidate="ddlCoverType" InitialValue="-1" ErrorMessage="Required" />
                            </td>                           
                        </tr>
                        <tr>
                            <td align="left" width="25%" height="25">NRIC</td>
                            <td>
                                <asp:TextBox ID="txtNRIC" runat="server" MaxLength="15"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="rfvNRIC" ValidationGroup="moredetails" runat="server"
                                        ControlToValidate="txtNRIC"   ErrorMessage="Required" />
                            </td>
                            <td align="left" colspan="2">Any Suspension of Driving License? :
                                <asp:DropDownList ID="ddlSuspensionDrivingLicense" runat="server">
                                    <asp:ListItem Value="-1">Select</asp:ListItem>
                                    <asp:ListItem Value="No">No</asp:ListItem>
                                    <asp:ListItem Value="Yes">Yes</asp:ListItem>
                                </asp:DropDownList>
                                <asp:RequiredFieldValidator ID="rfvSuspensionDrivingLicense" ValidationGroup="moredetails" runat="server"
                                        ControlToValidate="ddlSuspensionDrivingLicense" InitialValue="-1" ErrorMessage="Required" />
                            </td>                       
                        </tr>
                        <tr>
                            <td align="left" colspan="4">Any motor policy cancelled or declined for renewal by insurers? :
                                <asp:DropDownList ID="ddlPolicyCancelled" runat="server">
                                    <asp:ListItem Value="-1">Select</asp:ListItem>
                                    <asp:ListItem Value="No">No</asp:ListItem>
                                    <asp:ListItem Value="Yes">Yes</asp:ListItem>
                                </asp:DropDownList>
                                <asp:RequiredFieldValidator ID="rfvPolicyCancelled" ValidationGroup="moredetails" runat="server"
                                        ControlToValidate="ddlPolicyCancelled" InitialValue="-1" ErrorMessage="Required" />
                            </td>                       
                        </tr> 
                        <asp:Panel ID="pnlDrivers" runat="server" Visible="false">
                            <tr>
                                <td colspan="4"><br />
                                    <asp:Panel ID="pnlDriver1" runat="server" Visible="false">
                                        <asp:Label ID="Label4" runat="server" Text="Driver More Details" Font-Size="Large" Font-Bold="true" />
                                        <table cellpadding="2" cellspacing="2" width="100%">
                                            <tr><td colspan="4" align="left"><asp:Label ID="lblDriverDOB1" runat="server" Font-Bold="true"></asp:Label></td></tr>
                                            <tr>
                                                <td align="left" width="25%" height="25">1st Driver Name:</td>
                                                <td>
                                                    <asp:TextBox ID="txtDriverName1" runat="server" MaxLength="50"></asp:TextBox>
                                                    <asp:RequiredFieldValidator ID="rfvDriverName1" ValidationGroup="moredetails" runat="server"
                                                        ControlToValidate="txtDriverName1"   ErrorMessage="Required" />
                                                </td>
                                                <td align="left">1st Driver NRIC:</td>
                                                <td>
                                                    <asp:TextBox ID="txtDriverNRIC1" runat="server" MaxLength="15"></asp:TextBox>
                                                    <asp:RequiredFieldValidator ID="rfvDriverNRIC1" ValidationGroup="moredetails" runat="server"
                                                        ControlToValidate="txtDriverNRIC1"   ErrorMessage="Required" />
                                                </td>
                                              </tr>
                                              <tr>
                                                <td align="left" width="25%" height="25">1st License Pass Date: (dd/MM/yyyy)</td>
                                                <td>
                                                    <asp:TextBox ID="txtDriverLicensePassDate1" runat="server" MaxLength="10"></asp:TextBox>
                                                    <asp:RequiredFieldValidator ID="rfvDriverLicensePassDate1" ValidationGroup="moredetails" runat="server"
                                                        ControlToValidate="txtDriverLicensePassDate1"   ErrorMessage="Required" />
                                                </td>
                                                <td align="left">1st Driver Relation:</td>
                                                <td>
                                                    <asp:TextBox ID="txtDriverRelation1" runat="server" MaxLength="20"></asp:TextBox>
                                                    <asp:RequiredFieldValidator ID="rfvDriverRelation1" ValidationGroup="moredetails" runat="server"
                                                        ControlToValidate="txtDriverRelation1"   ErrorMessage="Required" />
                                                </td>
                                            </tr>
                                        </table><br />
                                    </asp:Panel>
                                    <asp:Panel ID="pnlDriver2" runat="server" Visible="false">
                                        <table cellpadding="2" cellspacing="2" width="100%">
                                            <tr><td colspan="4" align="left"><asp:Label ID="lblDriverDOB2" runat="server" Font-Bold="true"></asp:Label></td></tr>
                                            <tr>
                                                <td align="left" width="25%" height="25">2nd Driver Name:</td>
                                                <td>
                                                    <asp:TextBox ID="txtDriverName2" runat="server" MaxLength="50"></asp:TextBox>
                                                    <asp:RequiredFieldValidator ID="rfvDriverName2" ValidationGroup="moredetails" runat="server"
                                                        ControlToValidate="txtDriverName2"   ErrorMessage="Required" />
                                                </td>
                                                <td align="left">2nd Driver NRIC:</td>
                                                <td>
                                                    <asp:TextBox ID="txtDriverNRIC2" runat="server" MaxLength="15"></asp:TextBox>
                                                    <asp:RequiredFieldValidator ID="rfvDriverNRIC2" ValidationGroup="moredetails" runat="server"
                                                        ControlToValidate="txtDriverNRIC2"   ErrorMessage="Required" />
                                                </td>
                                             </tr>
                                             <tr>
                                                <td align="left" width="25%" height="25">2nd License Pass Date: (dd/MM/yyyy)</td>
                                                <td>
                                                    <asp:TextBox ID="txtDriverLicensePassDate2" runat="server" MaxLength="10"></asp:TextBox>
                                                    <asp:RequiredFieldValidator ID="rfvDriverLicensePassDate2" ValidationGroup="moredetails" runat="server"
                                                        ControlToValidate="txtDriverLicensePassDate2"   ErrorMessage="Required" />
                                                </td>
                                                <td align="left">2nd Driver Relation:</td>
                                                <td>
                                                    <asp:TextBox ID="txtDriverRelation2" runat="server" MaxLength="20"></asp:TextBox>
                                                    <asp:RequiredFieldValidator ID="rfvDriverRelation2" ValidationGroup="moredetails" runat="server"
                                                        ControlToValidate="txtDriverRelation2"   ErrorMessage="Required" />
                                                </td>
                                            </tr>
                                        </table><br />
                                    </asp:Panel>
                                    <asp:Panel ID="pnlDriver3" runat="server" Visible="false">
                                        <table cellpadding="2" cellspacing="2" width="100%">
                                            <tr><td colspan="4" align="left"><asp:Label ID="lblDriverDOB3" runat="server" Font-Bold="true"></asp:Label></td></tr>
                                            <tr>                                                
                                                <td align="left" width="25%" height="25">3rd Driver Name:</td>
                                                <td>
                                                    <asp:TextBox ID="txtDriverName3" runat="server" MaxLength="50"></asp:TextBox>
                                                    <asp:RequiredFieldValidator ID="rfvDriverName3" ValidationGroup="moredetails" runat="server"
                                                        ControlToValidate="txtDriverName3"   ErrorMessage="Required" />
                                                </td>
                                                <td align="left">3rd Driver NRIC:</td>
                                                <td>
                                                    <asp:TextBox ID="txtDriverNRIC3" runat="server" MaxLength="15"></asp:TextBox>
                                                    <asp:RequiredFieldValidator ID="rfvDriverNRIC3" ValidationGroup="moredetails" runat="server"
                                                        ControlToValidate="txtDriverNRIC3"   ErrorMessage="Required" />
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align="left" width="25%" height="25">3rd License Pass Date: (dd/MM/yyyy)</td>
                                                <td>
                                                    <asp:TextBox ID="txtDriverLicensePassDate3" runat="server" MaxLength="10"></asp:TextBox>
                                                    <asp:RequiredFieldValidator ID="rfvDriverLicensePassDate3" ValidationGroup="moredetails" runat="server"
                                                        ControlToValidate="txtDriverLicensePassDate3"   ErrorMessage="Required" />
                                                </td>
                                                <td align="left">3rd Driver Relation:</td>
                                                <td>
                                                    <asp:TextBox ID="txtDriverRelation3" runat="server" MaxLength="20"></asp:TextBox>
                                                    <asp:RequiredFieldValidator ID="rfvDriverRelation3" ValidationGroup="moredetails" runat="server"
                                                        ControlToValidate="txtDriverRelation3"   ErrorMessage="Required" />
                                                </td>
                                            </tr>
                                        </table><br />
                                    </asp:Panel>
                                    <asp:Panel ID="pnlDriver4" runat="server" Visible="false">
                                        <table cellpadding="2" cellspacing="2" width="100%">
                                            <tr><td colspan="4" align="left"><asp:Label ID="lblDriverDOB4" runat="server" Font-Bold="true"></asp:Label></td></tr>
                                            <tr>
                                                <td align="left" width="25%" height="25">4th Driver Name:</td>
                                                <td>
                                                    <asp:TextBox ID="txtDriverName4" runat="server" MaxLength="50"></asp:TextBox>
                                                    <asp:RequiredFieldValidator ID="rfvDriverName4" ValidationGroup="moredetails" runat="server"
                                                        ControlToValidate="txtDriverName4"   ErrorMessage="Required" />
                                                </td>
                                                <td align="left">4th Driver NRIC:</td>
                                                <td>
                                                    <asp:TextBox ID="txtDriverNRIC4" runat="server" MaxLength="15"></asp:TextBox>
                                                    <asp:RequiredFieldValidator ID="rfvDriverNRIC4" ValidationGroup="moredetails" runat="server"
                                                        ControlToValidate="txtDriverNRIC4"   ErrorMessage="Required" />
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align="left" width="25%" height="25">4th License Pass Date: (dd/MM/yyyy)</td>
                                                <td>
                                                    <asp:TextBox ID="txtDriverLicensePassDate4" runat="server" MaxLength="10"></asp:TextBox>
                                                    <asp:RequiredFieldValidator ID="rfvDriverLicensePassDate4" ValidationGroup="moredetails" runat="server"
                                                        ControlToValidate="txtDriverLicensePassDate4"   ErrorMessage="Required" />
                                                </td>
                                                <td align="left">4th Driver Relation:</td>
                                                <td>
                                                    <asp:TextBox ID="txtDriverRelation4" runat="server" MaxLength="20"></asp:TextBox>
                                                    <asp:RequiredFieldValidator ID="rfvDriverRelation4" ValidationGroup="moredetails" runat="server"
                                                        ControlToValidate="txtDriverRelation4"   ErrorMessage="Required" />
                                                </td>
                                            </tr>
                                        </table><br />
                                    </asp:Panel>
                                    <asp:Panel ID="pnlDriver5" runat="server" Visible="false">
                                        <table cellpadding="2" cellspacing="2" width="100%">
                                            <tr><td colspan="4" align="left"><asp:Label ID="lblDriverDOB5" runat="server" Font-Bold="true"></asp:Label></td></tr>
                                            <tr>
                                                <td align="left" width="25%" height="25">5th Driver Name:</td>
                                                <td>
                                                    <asp:TextBox ID="txtDriverName5" runat="server" MaxLength="50"></asp:TextBox>
                                                    <asp:RequiredFieldValidator ID="rfvDriverName5" ValidationGroup="moredetails" runat="server"
                                                        ControlToValidate="txtDriverName5"   ErrorMessage="Required" />
                                                </td>
                                                <td align="left">5th Driver NRIC:</td>
                                                <td>
                                                    <asp:TextBox ID="txtDriverNRIC5" runat="server" MaxLength="15"></asp:TextBox>
                                                    <asp:RequiredFieldValidator ID="rfvDriverNRIC5" ValidationGroup="moredetails" runat="server"
                                                        ControlToValidate="txtDriverNRIC5"   ErrorMessage="Required" />
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align="left" width="25%" height="25">5th License Pass Date: (dd/MM/yyyy)</td>
                                                <td>
                                                    <asp:TextBox ID="txtDriverLicensePassDate5" runat="server" MaxLength="10"></asp:TextBox>
                                                    <asp:RequiredFieldValidator ID="rfvDriverLicensePassDate5" ValidationGroup="moredetails" runat="server"
                                                        ControlToValidate="txtDriverLicensePassDate5"   ErrorMessage="Required" />
                                                </td>
                                                <td align="left">5th Driver Relation:</td>
                                                <td>
                                                    <asp:TextBox ID="txtDriverRelation5" runat="server" MaxLength="20"></asp:TextBox>
                                                    <asp:RequiredFieldValidator ID="rfvDriverRelation5" ValidationGroup="moredetails" runat="server"
                                                        ControlToValidate="txtDriverRelation5"   ErrorMessage="Required" />
                                                </td>
                                            </tr>
                                        </table><br />
                                    </asp:Panel>
                                </td>
                            </tr>
                        </asp:Panel>
                        <div style="display:none;">
                            <asp:TextBox ID="txtDriverId1" runat="server" Text="0"></asp:TextBox>
                            <asp:TextBox ID="txtDriverId2" runat="server" Text="0"></asp:TextBox>
                            <asp:TextBox ID="txtDriverId3" runat="server" Text="0"></asp:TextBox>
                            <asp:TextBox ID="txtDriverId4" runat="server" Text="0"></asp:TextBox>
                            <asp:TextBox ID="txtDriverId5" runat="server" Text="0"></asp:TextBox>
                        </div>
                        <tr>
                            <td colspan="4" align="left" height="25">
                                <asp:Button ID="btnSubmitMore" runat="server" Text="Submit" 
                                    ValidationGroup="moredetails" onclick="btnSubmitMore_Click" />
                                <asp:Label ID="lblMoreDetailsMessage" runat="server" ForeColor="Green" Font-Bold="true"></asp:Label>
                                <asp:Label ID="lblMoreDetailsError" runat="server" ForeColor="red" Font-Bold="true"></asp:Label>
                            </td>
                        </tr>
                    </table>
                </div><br />
            </ContentTemplate>
        </asp:UpdatePanel>
        
        <asp:UpdatePanel ID="uplPremiumList" runat="server">
            <ContentTemplate>
                <div runat="server" id="divPremiumList" visible="false">
                    <h3><asp:Label ID="Label6" runat="server" Text="Broker Premium List" /></h3>
                    <asp:GridView ID="grvPremiumList" runat="server" AllowPaging="True" AutoGenerateColumns="False"
                        CellPadding="2" EmptyDataText="There are no data records to display." CssClass="progridstyle"
                        SelectedRowStyle-CssClass="progridodd" GridLines="None" PagerStyle-CssClass="pgrpro"
                        DataSourceID="sqlDsPremiumList" DataKeyNames="ProviderCoverTypeId,CXBrokerPremiumId" 
                        onrowcommand="grvPremiumList_RowCommand">
                        <Columns>
                            <asp:BoundField DataField="CXBrokerPremiumId" Visible="false" HeaderText="CXBrokerPremiumId"
                                SortExpression="CXBrokerPremiumId" />
                            <asp:BoundField DataField="ProviderCoverTypeId" Visible="false" HeaderText="ProviderCoverTypeId"
                                SortExpression="ProviderCoverTypeId" />
                            <asp:BoundField DataField="AgentName" HeaderText="Agent Name" SortExpression="AgentName" />
                            <asp:BoundField DataField="CompanyName" HeaderText="Insurer Name" SortExpression="CompanyName" />
                            <asp:BoundField DataField="ProviderCoverTypeDesc" HeaderText="CoverType" SortExpression="ProviderCoverTypeDesc" />
                            <asp:BoundField DataField="Package" HeaderText="Package" SortExpression="Package" />
                            <asp:BoundField DataField="WorkShop" HeaderText="WorkShop" SortExpression="WorkShop" />
                            <asp:BoundField DataField="Premium" HeaderText="Premium" SortExpression="Premium" />
                            <asp:BoundField DataField="Excess" HeaderText="Excess" SortExpression="Excess" />
                            <asp:BoundField DataField="SelectedStatus" HeaderText="Selected" SortExpression="SelectedStatus" />
                            <asp:BoundField DataField="ModifiedDate" DataFormatString="{0:dd/MMM/yyyy hh:mm:ss tt}"
                                HeaderText="Submitted Date/Time" SortExpression="ModifiedDate" />
                            <asp:TemplateField HeaderText="Delete">
                                <ItemTemplate>
                                    <asp:Button runat="server" ID="btnDelete" Text="Delete"  CommandName="Delete" CommandArgument='<%#Eval("CXBrokerPremiumId")%>' OnClientClick="javascript:return confirm('Do you want to delete the Premium?')" /> 
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                        <FooterStyle />
                        <PagerStyle />
                        <SelectedRowStyle CssClass="progridover" />
                        <HeaderStyle CssClass="progridheader" />
                        <EditRowStyle />
                        <AlternatingRowStyle CssClass="progridodd" />
                        <RowStyle CssClass="progrideven" />
                    </asp:GridView>
                    <asp:SqlDataSource ID="sqlDsPremiumList" runat="server" ConnectionString="<%$ ConnectionStrings:CX_CRMDBConnectionString %>"
                        SelectCommand="sprocCXBrokerPremiumSelectItemList" SelectCommandType="StoredProcedure"
                        DeleteCommand="sprocCXBrokerPremiumDeleteSingleItem" DeleteCommandType="StoredProcedure" >
                        <SelectParameters>
                            <asp:ControlParameter ControlID="txtCarId" Name="CECarId" DefaultValue="0" PropertyName="Text"
                                Type="Int64" />
                        </SelectParameters>
                        <DeleteParameters>                        
                            <asp:Parameter Name="CXBrokerPremiumId" DefaultValue="0" Type="Int64" />
                            <asp:Parameter Name="AgentId" DefaultValue="0" Type="Int64" />
                        </DeleteParameters>
                    </asp:SqlDataSource>
                </div>
                <asp:HyperLink ID="hplPremiumDownLoad" runat="server" Visible="false" Target="_blank">DOWNLOAD PREMIUM</asp:HyperLink>
                <asp:Button ID="btnPremiumDownload" runat="server" Text="DOWNLOAD PREMIUM" Visible="false"
                    OnClick="btnPremiumDownload_Click" />
            </ContentTemplate>
        </asp:UpdatePanel>
        <div class="clear"></div>
        <div>
            <table border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td style="width: 55%;">
                        <asp:UpdatePanel ID="uplCXBrokerPremium" runat="server">
                            <ContentTemplate>
                                <div style="display: none;">
                                    <asp:TextBox runat="server" ID="txtPremiumId" Text="0"></asp:TextBox>
                                </div><br />
                                <div id="divCXBrokerPremium" runat="server" visible="false">
                                    <h3>
                                        <asp:Label ID="Label5" runat="server" Text="Broker Premium" /></h3>
                                    <table cellpadding="5" cellspacing="5" width="100%" border="0">
                                        <tr>
                                            <td width="100" height="25">
                                                Broker
                                            </td>
                                            <td>
                                                :
                                            </td>
                                            <td>
                                                <asp:DropDownList ID="ddlBrokerProvider" runat="server" OnSelectedIndexChanged="ddlBrokerProvider_SelectedIndexChanged"
                                                    AutoPostBack="True">
                                                </asp:DropDownList>
                                                <asp:RequiredFieldValidator ID="rfvBrokerProvider" ValidationGroup="premium" runat="server"
                                                    ControlToValidate="ddlBrokerProvider" InitialValue="-1" ErrorMessage="Please select." />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td height="25">
                                                Cover Type
                                            </td>
                                            <td>
                                                :
                                            </td>
                                            <td>
                                                <asp:DropDownList ID="ddlBrokerCoverType" runat="server" OnSelectedIndexChanged="ddlBrokerCoverType_SelectedIndexChanged"
                                                    AutoPostBack="True">
                                                </asp:DropDownList>
                                                <asp:RequiredFieldValidator ID="rfvBrokerCoverType" ValidationGroup="premium" runat="server"
                                                    ControlToValidate="ddlBrokerCoverType" InitialValue="-1" ErrorMessage="Please select." />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td height="25">
                                                Premium
                                            </td>
                                            <td>
                                                :
                                            </td>
                                            <td>
                                                <asp:TextBox ID="txtPremium" runat="server" MaxLength="12" Width="120px"></asp:TextBox>
                                                <asp:RequiredFieldValidator ID="rfvPremium" runat="server" ControlToValidate="txtPremium"
                                                    ErrorMessage="Premium." Display="Dynamic" ValidationGroup="premium"></asp:RequiredFieldValidator>
                                                <asp:RegularExpressionValidator ID="revPremium" runat="server" ControlToValidate="txtPremium"
                                                    ValidationGroup="premium" ErrorMessage="Not valid." ValidationExpression="^[0-9]+(\.[0-9]{1,2})?$"></asp:RegularExpressionValidator>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td height="25">
                                                Excess
                                            </td>
                                            <td>
                                                :
                                            </td>
                                            <td>
                                                <asp:TextBox ID="txtExcess" runat="server" MaxLength="12" Width="120px"></asp:TextBox>
                                                <asp:RequiredFieldValidator ID="rfvExcess" runat="server" ControlToValidate="txtExcess"
                                                    ErrorMessage="Excess." Display="Dynamic" ValidationGroup="premium"></asp:RequiredFieldValidator>
                                                <asp:RegularExpressionValidator ID="revExcess" runat="server" ControlToValidate="txtExcess"
                                                    ValidationGroup="premium" ErrorMessage="Not valid." ValidationExpression="^[0-9]+(\.[0-9]{1,2})?$"></asp:RegularExpressionValidator>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td height="25">
                                                Package
                                            </td>
                                            <td>
                                                :
                                            </td>
                                            <td>
                                                <asp:TextBox ID="txtPremiumPackage" runat="server" MaxLength="50" Width="200px"></asp:TextBox>
                                                <asp:RequiredFieldValidator ID="rfvPremiumPackage" runat="server" ControlToValidate="txtPremiumPackage"
                                                    Display="Dynamic" ErrorMessage="Package" Text="Package."
                                                    ValidationGroup="premium"></asp:RequiredFieldValidator>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td height="25">
                                                WorkShop
                                            </td>
                                            <td>
                                                :
                                            </td>
                                            <td>
                                                <asp:TextBox ID="txtWorkShop" runat="server" MaxLength="100" Width="300px"></asp:TextBox>
                                                <asp:RequiredFieldValidator ID="rfvWorkShop" runat="server" ControlToValidate="txtWorkShop"
                                                    Display="Dynamic" ErrorMessage="WorkShop" Text="WorkShop."
                                                    ValidationGroup="premium"></asp:RequiredFieldValidator>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td height="25">
                                                &nbsp;
                                            </td>
                                            <td>
                                                &nbsp;
                                            </td>
                                            <td>
                                                <asp:CheckBox ID="chkSelected" runat="server" Text="Select this Premium for Customer" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td height="25">
                                                &nbsp;
                                            </td>
                                            <td>
                                                &nbsp;
                                            </td>
                                            <td>
                                                <asp:Button ID="btnSubmitPremium" runat="server" Text="Submit Premium" ValidationGroup="premium"
                                                    OnClick="btnSubmitPremium_Click" />
                                                <asp:Label ID="lblPremiumMessage" runat="server" ForeColor="Green" Font-Bold="true"></asp:Label>
                                                <asp:Label ID="lblPremiumError" runat="server" ForeColor="Red" Font-Bold="true"></asp:Label>
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                            </ContentTemplate>
                        </asp:UpdatePanel>
                    </td>
                    <td style="width: 45%;">
                        <div id="divBrokerCallStatus" runat="server" visible="false">
                            <h3>
                                <asp:Label ID="Label22" runat="server" Text="Broker Call Status" /></h3>
                            <table cellpadding="5" cellspacing="5" width="100%">
                                <tr>
                                    <td width="120" height="25">
                                        Status
                                    </td>
                                    <td>
                                        :
                                    </td>
                                    <td>
                                        <asp:DropDownList ID="ddlBrokerCallStatus" runat="server">
                                            <asp:ListItem Text="None" Value="-1" />
                                            <asp:ListItem Text="Positive" Value="1" />
                                            <asp:ListItem Text="Negative" Value="0" />
                                            <asp:ListItem Text="Follow-up" Value="2" />
                                        </asp:DropDownList>
                                        <asp:RequiredFieldValidator ID="rfvBrokerCallStatus" ValidationGroup="brokercallstatus" runat="server"
                                            ControlToValidate="ddlBrokerCallStatus" Display="Dynamic" InitialValue="-1" ErrorMessage="Please select." />
                                        <asp:Label runat="server" ID="lblBrokerCallStatusMessage" Font-Bold="true" ForeColor="Red" />
                                    </td>
                                </tr>
                                <tr>
                                    <td height="25" valign="top">
                                        Remark
                                    </td>
                                    <td valign="top">
                                        :
                                    </td>
                                    <td>
                                        <asp:TextBox runat="server" TextMode="MultiLine" Height="115px" Width="350" ID="txtBrokerRemark" />
                                    </td>
                                </tr>
                                <tr>
                                    <td height="30">
                                        &nbsp;
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                    <td>
                                        <asp:Button runat="server" Font-Bold="true" ValidationGroup="brokercallstatus" ID="btnBrokerCallStatus"
                                            Text="Submit" OnClick="btnBrokerCallStatus_Click" Width="61px" />

                                        <script type="text/jscript">
                                            //OnClientClick = "return SubmitConfirm()"
                                            function SubmitConfirm() {
                                                var _retVal = false;
                                                if (Page_ClientValidate('brokercallstatus')) {
                                                    _retVal = confirm('Confirm to submit');
                                                }
                                                else {
                                                    ShowDiv();
                                                }
                                                return _retVal;
                                            }
                                        </script>

                                    </td>
                                </tr>
                            </table>
                        </div>
                    </td>
                </tr>
            </table>
            <div id="div2" class="tbl_wrap"></div>
            <div class="sep">
            </div>
        </div>
        <div style="display: none">
            <asp:TextBox runat="server" ReadOnly="true" ID="txtCXCRMId" />
            <asp:TextBox runat="server" ReadOnly="true" ID="txtCustomerId" />
            <asp:TextBox runat="server" ReadOnly="true" ID="txtCarId" />
            <asp:TextBox runat="server" ReadOnly="true" ID="txtCarPolicyId" />
            <asp:TextBox runat="server" ReadOnly="true" ID="txtCarResultId" />
            <asp:TextBox runat="server" ReadOnly="true" ID="txtServerPath" />
            <asp:TextBox runat="server" ReadOnly="true" ID="txtAgentId" />
            <asp:TextBox runat="server" ID="txtCallStatusId" Text="0"></asp:TextBox>
            <asp:TextBox runat="server" ID="txtContactNo" Text="0"></asp:TextBox>
            <asp:TextBox runat="server" ID="txtNoofDriver" Text="0" />
            <asp:TextBox runat="server" ID="txtBrokerCallStatusId" Text="0"></asp:TextBox>
        </div>
        <br />

        <h3><asp:Label ID="Label1" runat="server" Text="Quotes" Font-Size="Large" Font-Bold="true" /></h3>

        <asp:GridView ID="grvCarInsuranceCheapestQuote" runat="server" AllowPaging="True"
            AutoGenerateColumns="False" CellPadding="2" EmptyDataText="There are no data records to display."
            CssClass="progridstyle" GridLines="None" OnSelectedIndexChanged="grvCarInsurance_SelectedIndexChanged"
            DataSourceID="sqlDsCarInsuranceCheapestQuote" DataKeyNames="CITempResultId" OnRowCreated="grvCarInsuranceCheapestQuote_RowCreated"
            OnRowDataBound="grvCarInsuranceCheapestQuote_RowDataBound">
            <Columns>
                <asp:BoundField DataField="CITempResultId" Visible="false" HeaderText="CITempResultId"
                    SortExpression="CITempResultId" InsertVisible="False" ReadOnly="True" />
                <asp:BoundField DataField="RefCEUserId" Visible="false" HeaderText="RefCEUserId"
                    SortExpression="RefCEUserId" />
                <asp:BoundField DataField="CECarId" Visible="false" HeaderText="CECarId" SortExpression="CECarId" />
                <asp:BoundField DataField="ProviderCompanyId" Visible="false" HeaderText="ProviderCompanyId"
                    SortExpression="ProviderCompanyId" />
                <asp:BoundField DataField="CompanyName" HeaderText="Company" SortExpression="CompanyName" />
                <asp:BoundField DataField="CXCoverTypeId" Visible="false" HeaderText="CXCoverTypeId"
                    SortExpression="CXCoverTypeId" />
                <asp:BoundField DataField="ProviderCoverTypeDesc" HeaderStyle-Width="110" HeaderText="Cover Type"
                    SortExpression="Cover Type" />
                <asp:BoundField DataField="AnnualPremium" HeaderStyle-Width="90" DataFormatString="{0:c}"
                    HeaderText="Premium" SortExpression="AnnualPremium" />
                <asp:BoundField DataField="Excess" HeaderStyle-Width="60" DataFormatString="${0:#,0}"
                    HeaderText="Excess" SortExpression="Excess" />
                <asp:BoundField DataField="PlanName" HeaderStyle-Width="90" HeaderText="Plan Name"
                    SortExpression="PlanName" />
                <asp:BoundField DataField="PolicyHolder" HeaderStyle-Width="90" DataFormatString="${0:#,0}"
                    HtmlEncode="false" HeaderText="Personal<br/>Accident<br/><span>(Insured)</span>"
                    SortExpression="PolicyHolder" />
                <asp:BoundField DataField="PassengerEach" HtmlEncode="false" DataFormatString="${0:#,0}"
                    HeaderText="Personal<br/>Accident<br/><span>(Each Passenger)</span>" SortExpression="PassengerEach" />
                <asp:BoundField DataField="MedicalExpense" HtmlEncode="false" DataFormatString="${0:#,0}"
                    HeaderText="Medical<br/>Expense" SortExpression="MedicalExpense" />
                <asp:BoundField DataField="CashAllowance" Visible="false" HeaderText="CashAllowance"
                    SortExpression="CashAllowance" />
                <asp:BoundField DataField="PersonnalEffectsLoss" DataFormatString="${0:#,0}" HtmlEncode="false"
                    HeaderText="Loss of <br/>Personal Effects" SortExpression="PersonnalEffectsLoss" />
                <asp:BoundField DataField="IsNCDInclude" HeaderText="NCD Include" SortExpression="IsNCDInclude" />
                <asp:BoundField DataField="ModifiedDate" Visible="false" HeaderText="ModifiedDate"
                    SortExpression="ModifiedDate" />
                <asp:HyperLinkField DataNavigateUrlFields="BuyUrl" HeaderText="" Text="Buy Now" Target="_blank"
                    SortExpression="BuyUrl" />
            </Columns>
            <FooterStyle />
            <PagerStyle />
            <SelectedRowStyle CssClass="progridover" />
            <HeaderStyle CssClass="progridheader" />
            <EditRowStyle />
            <AlternatingRowStyle CssClass="progridodd" />
            <RowStyle CssClass="progrideven" />
        </asp:GridView>
        <asp:SqlDataSource ID="sqlDsCarInsuranceCheapestQuote" runat="server" ConnectionString="<%$ ConnectionStrings:CX_CRMDBConnectionString %>"
            SelectCommand="sprocCXCarInsuranceResultSelectChepestQuote" SelectCommandType="StoredProcedure">
            <SelectParameters>
                <asp:ControlParameter ControlID="txtCustomerId" Name="RefCEUserId" PropertyName="Text"
                    Type="Int64" />
                <asp:ControlParameter ControlID="txtCarId" Name="CECarId" PropertyName="Text" Type="Int64" />
                <asp:ControlParameter ControlID="txtServerPath" Name="ServerPath" PropertyName="Text"
                    Type="String" />
                <asp:ControlParameter ControlID="txtAgentId" Name="AgentId" PropertyName="Text" Type="String" />
            </SelectParameters>
        </asp:SqlDataSource>
        <br />
        <br />
        <div style="display:none;"><!-- Sakthi on 14 Jul 2011  - Start -->
        <asp:UpdatePanel ID="uplCallStatus" runat="server">
            <ContentTemplate>
                <div id="divCallStatus" style="float: left;" runat="server" visible="false">
                    <asp:Label ID="Label2" runat="server" Text="Call Status" Font-Size="Large" Font-Bold="true" />
                    <table cellpadding="5" cellspacing="5" width="100%">
                        <tr>
                            <td>
                                Call For
                            </td>
                            <td>
                                :
                            </td>
                            <td>
                                <asp:DropDownList ID="ddlCallFor" runat="server" OnSelectedIndexChanged="ddlCallFor_SelectedIndexChanged"
                                    AutoPostBack="True">
                                    <asp:ListItem Text="Select" Value="-1" />
                                    <asp:ListItem Text="Car Insurance" Value="100" />
                                    <asp:ListItem Text="Personal Accident" Value="200" />
                                </asp:DropDownList>
                                <asp:RequiredFieldValidator ID="rfvCallFor" ValidationGroup="callstatus" runat="server"
                                    ControlToValidate="ddlCallFor" InitialValue="-1" ErrorMessage="Please select." />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Status
                            </td>
                            <td>
                                :
                            </td>
                            <td>
                                <asp:DropDownList ID="ddlCICallStatus" Enabled="false" runat="server">
                                    <asp:ListItem Text="Select" Value="-1" />
                                    <asp:ListItem Text="Positive" Value="1" />
                                    <asp:ListItem Text="Negative" Value="0" />
                                </asp:DropDownList>
                                <asp:RequiredFieldValidator ID="rfvCICallStatus" ValidationGroup="callstatus" runat="server"
                                    ControlToValidate="ddlCICallStatus" Display="Dynamic" InitialValue="-1" ErrorMessage="Please select." />
                                <asp:DropDownList ID="ddlPACallStatus" Visible="false" runat="server">
                                    <asp:ListItem Text="Select" Value="-1" />
                                    <asp:ListItem Text="Positive" Value="1" />
                                    <asp:ListItem Text="Negative" Value="0" />
                                </asp:DropDownList>
                                <asp:RequiredFieldValidator ID="rfvPACallStatus" Enabled="false" ValidationGroup="callstatus"
                                    runat="server" ControlToValidate="ddlPACallStatus" Display="Dynamic" InitialValue="-1"
                                    ErrorMessage="Please select." />
                                <asp:Label runat="server" ID="lblCallStatusMessage" Font-Bold="true" ForeColor="Red" />
                            </td>
                        </tr>
                        <asp:Panel runat="server" ID="pnlCallStatus" Visible="false">
                            <tr>
                                <td>
                                    Call Me Status
                                </td>
                                <td>
                                    :
                                </td>
                                <td>
                                    <asp:TextBox runat="server" TextMode="MultiLine" Height="100px" Width="700px" ID="txtCallStatus"
                                        ReadOnly="true" />
                                </td>
                            </tr>
                        </asp:Panel>
                        <tr>
                            <td>
                                Remark
                            </td>
                            <td>
                                :
                            </td>
                            <td>
                                <asp:TextBox runat="server" TextMode="MultiLine" Visible="false" Height="100px" Width="700px"
                                    ID="txtCIRemark" />
                                <asp:TextBox runat="server" TextMode="MultiLine" Visible="false" Height="100px" Width="700px"
                                    ID="txtPARemark" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                            </td>
                            <td>
                            </td>
                            <td>
                                <%--OnClientClick="javascript:return confirm('Confirm to submit?');"--%>
                                <asp:Button runat="server" Font-Bold="true" ValidationGroup="callstatus" ID="btnCallStatus"
                                    Text="Submit" OnClick="btnCallStatus_Click" Width="61px" OnClientClick="return SubmitConfirm()" />
                            </td>
                        </tr>
                    </table>
                </div>
            </ContentTemplate>
        </asp:UpdatePanel>
        </div><!-- Sakthi on 14 Jul 2011  - End -->
    </div>
    <br />
    <br />

    <script type="text/jscript">
        function SubmitConfirm() {
            var _retVal = false;
            if (Page_ClientValidate('callstatus')) {
                _retVal = confirm('Confirm to submit');
            }
            else {
                ShowDiv();
            }
            return _retVal;
        }
    </script>

</asp:Content>

